package com.yh.service.impl;

import com.yh.entity.User;
import com.yh.mapper.UserMapper;
import com.yh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public void createUser() {
        for(int i=1;i<=100;i++){
            User user = new User();
            user.setName("妙脆角");
            userMapper.insert(user);
        }
    }

    @Override
    public User getUserById(Long userId) {
        return userMapper.selectById(userId);
    }

    @Override
    public List<User> getUsers(List<Long> userIds) {
        return userMapper.selectBatchIds(userIds);
    }
}
